<!DOCTYPE html> 
<html> 
<head>  
    <!--META-->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=0.75">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">

    <!--CSS-->
    <link rel="stylesheet" href="API/css/themes/default/jquery.mobile.min.css" />
    <link rel="stylesheet" href="API/css/themes/default/jquery.mobile.structure.min.css" />
    <link rel="stylesheet" href="API/css/themes/default/jquery.mobile.theme.min.css" />
    <link rel="stylesheet" href="API/css/mycss.css" />
    <link rel="stylesheet" href="css/mycss.css" />

    <!--JS-->
    <script type="text/javascript" src="API/js/jquery.min.js"></script>
    <script type="text/javascript" src="API/js/jquery.mobile.min.js"></script>
    <script type="text/javascript" src="API/js/highcharts.js"></script>
    <script type="text/javascript" src="API/js/modules/exporting.js"></script>
    <!--<script type="text/javascript" src="API/js/jquery.dataTables.min.js"></script>--> 
    <script type="text/javascript" src="include/config.js"></script>
    <script type="text/javascript" src="include/config.js"></script>
    <script type="text/javascript" src="API/js/fonctions.js"></script>
    <script type="text/javascript" src="js/fonctions.js"></script>

    <script language="javascript" type="text/javascript">
    checkMaintenance();
    checkAuthentification();
	
        ///////////////////
        //BLOCK VARIABLE GLOBAL
        ///////////////////
        var id_page = 3;

        ///////////////////
        //BLOCK FONCTIONS EVENEMENTS
        ///////////////////

        var indiceConfianceGene = 0;
        var tabCatOffres = new Array();
        var tabSeriesOffres = new Array();
        var tabCatFacture = new Array();
        var tabSeriesFacture = new Array();
        var tabCatAppel = new Array();
        var tabSeriesAppel = new Array();
        var tabCatAutres = new Array();
        var tabSeriesAutres = new Array();

        $(document).on('pageinit',function() {
            try {
                // Init commun
                init_commun();

                // Init page
                chargeTabOffres1();
                chargeTabFacture1();
                chargeTabAppel1();
                chargeTabAutres1();

                calcGeneral();
            }
            catch (er) {
                log(0, "ERROR(init_macrodomaines):" + er.message);
            }
        });
		
        $(document).on('pageshow',function() {
            try {
                show_commun();
            }
            catch (er) {
                log(0, "ERROR(show):" + er.message);
            }
        });

        /// SUBDOM
        function chargeTabSubDom() {
            try {
                var htmlTabSubDom = "";
                var tabResultatTabSubDom = new Array();

                tabResultatTabSubDom = getTabResultatTabSubDom();

                var tabCat = new Array();

                for (var indice in tabResultatTabSubDom) {
                    tabCat[tabCat.length] = tabResultatTabSubDom[indice][2];
                    var nbDomaine = parseInt(tabResultatTabSubDom[indice][1]);
                    if (nbDomaine == tabCat.length) {
                        break;
                    }
                }

                var tabSeries = new Array();
                var tabSubSeries = new Array();
                var tabSav = new Array();

                for (var indice in tabResultatTabSubDom) {
                    tabSubSeries[tabSubSeries.length] = parseInt(tabResultatTabSubDom[indice][4]);
                    if ((tabSubSeries.length % nbDomaine) == 0) {

                        tabSeries[tabSeries.length] = {
                            name: tabResultatTabSubDom[indice][3],
                            data: tabSubSeries
                        };

                        tabSav = tabSubSeries;

                        var tabSubSeries = new Array();
                    }
                }
				
                for (var indice in tabSav) {
                    tabSubSeries[tabSubSeries.length] = Math.round(tabSav[indice] * parseFloat(tabResultatTabSubDom[indice][0]));
                }

                var indiceConfiance = Math.round((1 / parseFloat(tabResultatTabSubDom[0][0]))*100);

                tabSeries[tabSeries.length] = {
                    name: "Prev",
                    data: tabSubSeries
                };

                tabCatAutres = tabCat;
                tabSeriesAutres = tabSeries;
                indiceConfianceGene = indiceConfiance;

                afficheSubDom(tabCat, tabSeries, indiceConfiance);
            }
            catch (er) {
                log(0, "ERROR(chargeTabSubDom):" + er.message);
            }
        }

        function getTabResultatTabSubDom() {
            try {
                var strResponse = "";
                var returns = new Array();
                var tempTab = new Array();
                var tempSubTab = new Array();

                xhr_object = new AJ();

                var url = "phpsql/mysql_getTabResultatTabSousDom.php?milis=" + getMilise() + "&crtl=ok";

                xhr_object.open("GET", url, false);
                xhr_object.send(null);
                if (xhr_object.readyState == 4) {
                    strResponse = xhr_object.responseText;
                } else {
                    strResponse = "ERROR";
                }

                tempTab = strResponse.split("\n");

                for (var indice in tempTab) {
                    tempSubTab = tempTab[indice].split("&");
                    if (tempSubTab.length > 1) {
                        returns[returns.length] = tempSubTab.slice(0, tempSubTab.length - 1);
                    }
                }

                delete xhr_object;

                return returns;
            }
            catch (er) {
                log(0, "ERROR(getTabResultatTabSubDom):" + er.message);
            }
        }

        function afficheSubDom(p_tabCat, p_tabSeries, p_indiceConfiance) {
            var chart;

            $(document).ready(function() {
                chart = new Highcharts.Chart({
                    exporting: {
                        url: 'http://export.highcharts.com',
                        filename: 'Sous Domaine',
                        width: 1600
                    },
                    chart: {
                        renderTo: 'div_tabSubDom',
                        defaultSeriesType: 'column'
                    },
                    title: {
                        text: 'Activit\351 par domaine et par mois'
                    },
                    subtitle: {
                        text: 'Source: ODA. Indice de confiance pour pr\351vision : ' + p_indiceConfiance + '%.'
                    },
                    xAxis: {
                        categories: p_tabCat
                    },
                    yAxis: {
                        min: 0,
                        title: {
                            text: 'Nombre de toc :'
                        }
                    },
                    legend: {
                        layout: 'vertical',
                        backgroundColor: '#FFFFFF',
                        align: 'left',
                        verticalAlign: 'top',
                        x: 50,
                        y: 0,
                        floating: true,
                        shadow: true
                    },
                    tooltip: {
                        formatter: function() {
                            return '' + this.x + ': ' + this.y + '.';
                        }
                    },
                    plotOptions: {
                        column: {
                            pointPadding: 0.2,
                            borderWidth: 0
                        }
                    },
                    series: p_tabSeries
                });
            });
        }
		
        // AUTRES
        function chargeTabAutres1() {
            try {
                var htmlTabAutres1 = "";
                var tabResultatTabAutres1 = new Array();

                tabResultatTabAutres1 = getTabResultatTabAutres1();

                var tabCat = new Array();

                for (var indice in tabResultatTabAutres1) {
                    tabCat[tabCat.length] = tabResultatTabAutres1[indice][2];
                    var nbDomaine = parseInt(tabResultatTabAutres1[indice][1]);
                    if (nbDomaine == tabCat.length) {
                        break;
                    }
                }

                var tabSeries = new Array();
                var tabSubSeries = new Array();
                var tabSav = new Array();

                for (var indice in tabResultatTabAutres1) {
                    tabSubSeries[tabSubSeries.length] = parseInt(tabResultatTabAutres1[indice][4]);
                    if ((tabSubSeries.length % nbDomaine) == 0) {

                        tabSeries[tabSeries.length] = {
                            name: tabResultatTabAutres1[indice][3],
                            data: tabSubSeries
                        };

                        tabSav = tabSubSeries;

                        var tabSubSeries = new Array();
                    }
                }

                for (var indice in tabSav) {
                    tabSubSeries[tabSubSeries.length] = Math.round(tabSav[indice] * parseFloat(tabResultatTabAutres1[indice][0]));
                }
				
                var indiceConfiance = Math.round((1 / parseFloat(tabResultatTabAutres1[0][0]))*100);

                tabSeries[tabSeries.length] = {
                    name: "Prev",
                    data: tabSubSeries
                };

                tabCatAutres = tabCat;
                tabSeriesAutres = tabSeries;
                indiceConfianceGene = indiceConfiance;

                afficheAutres1(tabCat, tabSeries, indiceConfiance);
            }
            catch (er) {
                log(0, "ERROR(chargeTabAutres1):" + er.message);
            }
        }

        function getTabResultatTabAutres1() {
            try {
                var strResponse = "";
                var returns = new Array();
                var tempTab = new Array();
                var tempSubTab = new Array();

                xhr_object = new AJ();

                var url = "phpsql/mysql_getTabResultatTabAutres1.php?milis=" + getMilise() + "&crtl=ok";

                xhr_object.open("GET", url, false);
                xhr_object.send(null);
                if (xhr_object.readyState == 4) {
                    strResponse = xhr_object.responseText;
                } else {
                    strResponse = "ERROR";
                }

                tempTab = strResponse.split("\n");

                for (var indice in tempTab) {
                    tempSubTab = tempTab[indice].split("&");
                    if (tempSubTab.length > 1) {
                        returns[returns.length] = tempSubTab.slice(0, tempSubTab.length - 1);
                    }
                }

                delete xhr_object;

                return returns;
            }
            catch (er) {
                log(0, "ERROR(getTabResultatTabAutres1):" + er.message);
            }
        }

        function afficheAutres1(p_tabCat, p_tabSeries, p_indiceConfiance) {
            var chart;

            $(document).ready(function() {
                chart = new Highcharts.Chart({
                    exporting: {
                        url: 'http://export.highcharts.com',
                        filename: 'Macro-domaine_autre',
                        width: 1600
                    },
                    chart: {
                        renderTo: 'div_tabAutres1',
                        defaultSeriesType: 'column'
                    },
                    title: {
                        text: 'Activit\351 par domaine et par mois'
                    },
                    subtitle: {
                        text: 'Source: ODA. Indice de confiance pour pr\351vision : ' + p_indiceConfiance + '%.'
                    },
                    xAxis: {
                        categories: p_tabCat
                    },
                    yAxis: {
                        min: 0,
                        title: {
                            text: 'Nombre de toc :'
                        }
                    },
                    legend: {
                        layout: 'vertical',
                        backgroundColor: '#FFFFFF',
                        align: 'left',
                        verticalAlign: 'top',
                        x: 50,
                        y: 0,
                        floating: true,
                        shadow: true
                    },
                    tooltip: {
                        formatter: function() {
                            return '' + this.x + ': ' + this.y + '.';
                        }
                    },
                    plotOptions: {
                        column: {
                            pointPadding: 0.2,
                            borderWidth: 0
                        }
                    },
                    series: p_tabSeries
                });
            });
        }
        
        // OFFRES
        function chargeTabOffres1() {
            try {
                var htmlTabOffres1 = "";
                var tabResultatTabOffres1 = new Array();

                tabResultatTabOffres1 = getTabResultatTabOffres1();

                var tabCat = new Array();

                for (var indice in tabResultatTabOffres1) {
                    tabCat[tabCat.length] = tabResultatTabOffres1[indice][2];
                    var nbDomaine = parseInt(tabResultatTabOffres1[indice][1]);
                    if (nbDomaine == tabCat.length) {
                        break;
                    }
                }

                var tabSeries = new Array();
                var tabSubSeries = new Array();
                var tabSav = new Array();

                for (var indice in tabResultatTabOffres1) {
                    tabSubSeries[tabSubSeries.length] = parseInt(tabResultatTabOffres1[indice][4]);
                    if ((tabSubSeries.length % nbDomaine) == 0) {

                        tabSeries[tabSeries.length] = {
                            name: tabResultatTabOffres1[indice][3],
                            data: tabSubSeries
                        };

                        tabSav = tabSubSeries;

                        var tabSubSeries = new Array();
                    }
                }
				
                for (var indice in tabSav) {
                    tabSubSeries[tabSubSeries.length] = Math.round(tabSav[indice] * parseFloat(tabResultatTabOffres1[indice][0]));
                }

                tabSeries[tabSeries.length] = {
                    name: "Prev",
                    data: tabSubSeries
                };

                var indiceConfiance = Math.round((1 / parseFloat(tabResultatTabOffres1[0][0]))*100);

                tabCatOffres = tabCat;
                tabSeriesOffres= tabSeries;

                afficheOffres1(tabCat, tabSeries, indiceConfiance);
            }
            catch (er) {
                log(0, "ERROR(chargeTabOffres0):" + er.message);
            }
        }

        function getTabResultatTabOffres1() {
            try {
                var strResponse = "";
                var returns = new Array();
                var tempTab = new Array();
                var tempSubTab = new Array();

                xhr_object = new AJ();

                var url = "phpsql/mysql_getTabResultatTabOffres1.php?milis="+getMilise()+"&crtl=ok";

                xhr_object.open("GET", url, false);
                xhr_object.send(null);
                if (xhr_object.readyState == 4) {
                    strResponse = xhr_object.responseText;
                } else {
                    strResponse = "ERROR";
                }

                tempTab = strResponse.split("\n");

                for (var indice in tempTab) {
                    tempSubTab = tempTab[indice].split("&");
                    if (tempSubTab.length > 1) {
                        returns[returns.length] = tempSubTab.slice(0, tempSubTab.length - 1);
                    }
                }

                delete xhr_object;

                return returns;
            }
            catch (er) {
                log(0, "ERROR(getTabResultatTabOffres1):" + er.message);
            }
        }

        function afficheOffres1(p_tabCat, p_tabSeries, p_indiceConfiance) {
            var chart;

            $(document).ready(function() {
                chart = new Highcharts.Chart({
                    exporting: {
                        url: 'http://export.highcharts.com',
                        filename: 'Macro-domaine_offres',
                        width: 1600
                    },
                    chart: {
                        renderTo: 'div_tabOffres1',
                        defaultSeriesType: 'column'
                    },
                    title: {
                        text: 'Activit\351 par domaine et par mois'
                    },
                    subtitle: {
                        text: 'Source: ODA. Indice de confiance pour pr\351vision : ' + p_indiceConfiance + '%.'
                    },
                    xAxis: {
                        categories: p_tabCat
                    },
                    yAxis: {
                        min: 0,
                        title: {
                                text: 'Nombre de toc :'
                        }
                    },
                    legend: {
                        layout: 'vertical',
                        backgroundColor: '#FFFFFF',
                        align: 'left',
                        verticalAlign: 'top',
                        x: 50,
                        y: 0,
                        floating: true,
                        shadow: true
                    },
                    tooltip: {
                        formatter: function() {
                            return '' + this.x + ': ' + this.y + '.';
                        }
                    },
                    plotOptions: {
                        column: {
                            pointPadding: 0.2,
                            borderWidth: 0
                        }
                    },
                    series: p_tabSeries
                });
            });
        }

        /////// FACTURATION
        function chargeTabFacture1() {
            try {
                var htmlTabFacture1 = "";
                var tabResultatTabFacture1 = new Array();

                tabResultatTabFacture1 = getTabResultatTabFacture1();

                var tabCat = new Array();

                for (var indice in tabResultatTabFacture1) {
                    tabCat[tabCat.length] = tabResultatTabFacture1[indice][2];
                    var nbDomaine = parseInt(tabResultatTabFacture1[indice][1]);
                    if (nbDomaine == tabCat.length) {
                        break;
                    }
                }

                var tabSeries = new Array();
                var tabSubSeries = new Array();
                var tabSav = new Array();

                for (var indice in tabResultatTabFacture1) {
                    tabSubSeries[tabSubSeries.length] = parseInt(tabResultatTabFacture1[indice][4]);
                    if ((tabSubSeries.length % nbDomaine) == 0) {

                        tabSeries[tabSeries.length] = {
                            name: tabResultatTabFacture1[indice][3],
                            data: tabSubSeries
                        };
						
                        tabSav = tabSubSeries;

                        var tabSubSeries = new Array();
                    }
                }
				
                for (var indice in tabSav) {
                    tabSubSeries[tabSubSeries.length] = Math.round(tabSav[indice] * parseFloat(tabResultatTabFacture1[indice][0]));
                }

                var indiceConfiance = Math.round((1 / parseFloat(tabResultatTabFacture1[0][0]))*100);

                tabSeries[tabSeries.length] = {
                    name: "Prev",
                    data: tabSubSeries
                };

                tabCatFacture = tabCat;
                tabSeriesFacture = tabSeries;

                afficheFacture1(tabCat, tabSeries, indiceConfiance);
            }
            catch (er) {
                log(0, "ERROR(chargeTabFacture0):" + er.message);
            }
        }

        function getTabResultatTabFacture1() {
            try {
                var strResponse = "";
                var returns = new Array();
                var tempTab = new Array();
                var tempSubTab = new Array();

                xhr_object = new AJ();

                var url = "phpsql/mysql_getTabResultatTabFacture1.php?milis=" + getMilise() + "&crtl=ok";

                xhr_object.open("GET", url, false);
                xhr_object.send(null);
                if (xhr_object.readyState == 4) {
                    strResponse = xhr_object.responseText;
                } else {
                    strResponse = "ERROR";
                }

                tempTab = strResponse.split("\n");

                for (var indice in tempTab) {
                    tempSubTab = tempTab[indice].split("&");
                    if (tempSubTab.length > 1) {
                        returns[returns.length] = tempSubTab.slice(0, tempSubTab.length - 1);
                    }
                }

                delete xhr_object;

                return returns;
            }
            catch (er) {
                log(0, "ERROR(getTabResultatTabFacture1):" + er.message);
            }
        }

        function afficheFacture1(p_tabCat, p_tabSeries, p_indiceConfiance) {
            var chart;

            $(document).ready(function() {
                chart = new Highcharts.Chart({
                    exporting: {
                        url: 'http://export.highcharts.com',
                        filename: 'Macro-domaine_facture',
                        width: 1600
                    },
                    chart: {
                        renderTo: 'div_tabFacture1',
                        defaultSeriesType: 'column'
                    },
                    title: {
                        text: 'Activit\351 par domaine et par mois'
                    },
                    subtitle: {
                        text: 'Source: ODA. Indice de confiance pour pr\351vision : ' + p_indiceConfiance + '%.'
                    },
                    xAxis: {
                        categories: p_tabCat
                    },
                    yAxis: {
                        min: 0,
                        title: {
                                text: 'Nombre de toc :'
                        }
                    },
                    legend: {
                        layout: 'vertical',
                        backgroundColor: '#FFFFFF',
                        align: 'left',
                        verticalAlign: 'top',
                        x: 50,
                        y: 0,
                        floating: true,
                        shadow: true
                    },
                    tooltip: {
                        formatter: function() {
                                return '' + this.x + ': ' + this.y + '.';
                        }
                    },
                    plotOptions: {
                        column: {
                            pointPadding: 0.2,
                            borderWidth: 0
                        }
                    },
                    series: p_tabSeries
                });
            });
        }

        /////// APPEL
        function chargeTabAppel1() {
            try {
                var htmlTabAppel1 = "";
                var tabResultatTabAppel1 = new Array();

                tabResultatTabAppel1 = getTabResultatTabAppel1();

                var tabCat = new Array();

                for (var indice in tabResultatTabAppel1) {
                    tabCat[tabCat.length] = tabResultatTabAppel1[indice][2];
                    var nbDomaine = parseInt(tabResultatTabAppel1[indice][1]);
                    if (nbDomaine == tabCat.length) {
                        break;
                    }
                }

                var tabSeries = new Array();
                var tabSubSeries = new Array();
                var tabSav = new Array();

                for (var indice in tabResultatTabAppel1) {
                    tabSubSeries[tabSubSeries.length] = parseInt(tabResultatTabAppel1[indice][4]);
                    if ((tabSubSeries.length % nbDomaine) == 0) {

                        tabSeries[tabSeries.length] = {
                            name: tabResultatTabAppel1[indice][3],
                            data: tabSubSeries
                        };
						
                        tabSav = tabSubSeries;

                        var tabSubSeries = new Array();
                    }
                }
				
                for (var indice in tabSav) {
                    tabSubSeries[tabSubSeries.length] = Math.round(tabSav[indice] * parseFloat(tabResultatTabAppel1[indice][0]));
                }

                var indiceConfiance = Math.round((1 / parseFloat(tabResultatTabAppel1[0][0]))*100);

                tabSeries[tabSeries.length] = {
                    name: "Prev",
                    data: tabSubSeries
                };

                tabCatAppel = tabCat;
                tabSeriesAppel= tabSeries;
				
                afficheAppel1(tabCat, tabSeries, indiceConfiance);
            }
            catch (er) {
                log(0, "ERROR(chargeTabAppel0):" + er.message);
            }
        }

        function getTabResultatTabAppel1() {
            try {
                var strResponse = "";
                var returns = new Array();
                var tempTab = new Array();
                var tempSubTab = new Array();

                xhr_object = new AJ();

                var url = "phpsql/mysql_getTabResultatTabAppel1.php?milis=" + getMilise() + "&crtl=ok";

                xhr_object.open("GET", url, false);
                xhr_object.send(null);
                if (xhr_object.readyState == 4) {
                    strResponse = xhr_object.responseText;
                } else {
                    strResponse = "ERROR";
                }

                tempTab = strResponse.split("\n");

                for (var indice in tempTab) {
                    tempSubTab = tempTab[indice].split("&");
                    if (tempSubTab.length > 1) {
                        returns[returns.length] = tempSubTab.slice(0, tempSubTab.length - 1);
                    }
                }

                delete xhr_object;

                return returns;
            }
            catch (er) {
                log(0, "ERROR(getTabResultatTabAppel1):" + er.message);
            }
        }

        function afficheAppel1(p_tabCat, p_tabSeries, p_indiceConfiance) {
            var chart;
                        
            $(document).ready(function() {
                chart = new Highcharts.Chart({
                    exporting: {
                        url: 'http://export.highcharts.com',
                        filename: 'Macro-domaine_appel',
                        width: 1600
                    },
                    chart: {
                        renderTo: 'div_tabAppel1',
                        defaultSeriesType: 'column'
                    },
                    title: {
                        text: 'Activit\351 par domaine et par mois'
                    },
                    subtitle: {
                        text: 'Source: ODA. Indice de confiance pour pr\351vision : ' + p_indiceConfiance + '%.'
                    },
                    xAxis: {
                        categories: p_tabCat
                    },
                    yAxis: {
                        min: 0,
                        title: {
                            text: 'Nombre de toc :'
                        }
                    },
                    legend: {
                        layout: 'vertical',
                        backgroundColor: '#FFFFFF',
                        align: 'left',
                        verticalAlign: 'top',
                        x: 50,
                        y: 0,
                        floating: true,
                        shadow: true
                    },
                    tooltip: {
                        formatter: function() {
                            return '' + this.x + ': ' + this.y + '.';
                        }
                    },
                    plotOptions: {
                        column: {
                            pointPadding: 0.2,
                            borderWidth: 0
                        }
                    },
                    series: p_tabSeries
                });
            });
        }
		
        //GENERAL
        function calcGeneral() {
            try {
                var mois_exclu = new Array("12-02","12-03","12-04","12-05","12-06","12-07");
                var tabDom = new Array();
                var gardien = false;

                for (var indiceDom in tabCatOffres) {
                        var tabIndice = new Array();
                        var tabTotalIndice = new Array();
                        for (var indiceIndice in tabSeriesOffres) {
                                if(gardien){
                                        tabDom["TOTAL"][tabIndice.length]["data"] = tabDom["TOTAL"][tabIndice.length]["data"] + tabSeriesOffres[indiceIndice]["data"][indiceDom];
                                }else{
                                        tabTotalIndice[tabTotalIndice.length] = {
                                                mois: tabSeriesOffres[indiceIndice]["name"],
                                                data: tabSeriesOffres[indiceIndice]["data"][indiceDom]
                                        };
                                }
                                tabIndice[tabIndice.length] = {
                                        mois: tabSeriesOffres[indiceIndice]["name"],
                                        data: tabSeriesOffres[indiceIndice]["data"][indiceDom]
                                };
                        }
                        tabDom[tabCatOffres[indiceDom]] = tabIndice;
                        if(gardien == false){
                                tabDom["TOTAL"] = tabTotalIndice;
                                gardien = true;
                        }

                }

                for (var indiceDom in tabCatFacture) {
                        var tabIndice = new Array();
                        for (var indiceIndice in tabSeriesFacture) {
                                tabDom["TOTAL"][tabIndice.length]["data"] = tabDom["TOTAL"][tabIndice.length]["data"] + tabSeriesFacture[indiceIndice]["data"][indiceDom];
                                tabIndice[tabIndice.length] = {
                                        mois: tabSeriesFacture[indiceIndice]["name"],
                                        data: tabSeriesFacture[indiceIndice]["data"][indiceDom]
                                };
                        }
                        tabDom[tabCatFacture[indiceDom]] = tabIndice;
                }

                for (var indiceDom in tabCatAppel) {
                        var tabIndice = new Array();
                        for (var indiceIndice in tabSeriesAppel) {
                                tabDom["TOTAL"][tabIndice.length]["data"] = tabDom["TOTAL"][tabIndice.length]["data"] + tabSeriesAppel[indiceIndice]["data"][indiceDom];
                                tabIndice[tabIndice.length] = {
                                        mois: tabSeriesAppel[indiceIndice]["name"],
                                        data: tabSeriesAppel[indiceIndice]["data"][indiceDom]
                                };
                        }
                        tabDom[tabCatAppel[indiceDom]] = tabIndice;
                }

                for (var indiceDom in tabCatAutres) {
                        var tabIndice = new Array();
                        for (var indiceIndice in tabSeriesAutres) {
                                tabDom["TOTAL"][tabIndice.length]["data"] = tabDom["TOTAL"][tabIndice.length]["data"] + tabSeriesAutres[indiceIndice]["data"][indiceDom];
                                tabIndice[tabIndice.length] = {
                                        mois: tabSeriesAutres[indiceIndice]["name"],
                                        data: tabSeriesAutres[indiceIndice]["data"][indiceDom]
                                };
                        }
                        tabDom[tabCatAutres[indiceDom]] = tabIndice;
                }

                strRetour = "";
                strRetour += "<table BORDER=\"1\" BORDERCOLOR=\"DarkGray\" cellspacing=\"0\" style=\"font-size:14px;background-color:white;text-shadow: none;\">";
                strRetour += "<TR>";
                strRetour += "<TH> <strong>DOMAINE</strong></TH>";
				
                for (var indiceDom in tabDom) {
                        for (var indice in tabDom[indiceDom]) {
                                if(jQuery.inArray(tabDom[indiceDom][indice]["mois"],mois_exclu)==-1){
                                        strRetour += "<TH>"+tabDom[indiceDom][indice]["mois"]+"</TH>";
                                        if((indice != 0) & (indice != (tabDom[indiceDom].length-2))){
                                                strRetour += "<TH>Evol</TH>";
                                                strRetour += "<TH>Part</TH>";
                                        }
                                }
                        }
                        break;
                }
                strRetour += "</TR>";
				
                var tabKey = new Array();
                for (var key in tabDom) {
                        tabKey[tabKey.length] = key;
                }

                var tabFixeDom = ['TOTAL','APPLICATION DIVERSES','DMM','FEWS','PNM','TECHNIQUE','WEB SERVICES','APPLICOM','MIGRATION TARIFAIRE','NVNO','OFFRE','PARAMETRAGE','STRUCTURES FFM/ SAE/...','EDITION','FACTURATION','JDE','REMISE','APPELS'];
                var tabFixeDom = [tabKey[1],tabKey[12],tabKey[13],tabKey[14],tabKey[15],tabKey[16],tabKey[17],tabKey[0],tabKey[2],tabKey[3],tabKey[4],tabKey[5],tabKey[6],tabKey[7],tabKey[8],tabKey[9],tabKey[10],tabKey[11]];


                for (var indiceDom in tabFixeDom) {
                        strRetour += "<TR onMouseOver=\"changeOutline(this,'solid','#FF0000');\" onMouseOut=\"changeOutline(this,'hidden','transparent');\" >";
                        strRetour += "<TD> <strong>"+tabFixeDom[indiceDom]+"</strong></TD>";
                        for (var indice in tabDom[tabFixeDom[indiceDom]]) {
                                if(jQuery.inArray(tabDom[tabFixeDom[indiceDom]][indice]["mois"],mois_exclu)==-1)
                                {
                                        strRetour += "<TD>"+tabDom[tabFixeDom[indiceDom]][indice]["data"]+"</TD>";
                                }
                                if((indice != 0) & (indice != (tabDom[tabFixeDom[indiceDom]].length-2))){
                                        try {
                                                if(indice == (tabDom[tabFixeDom[indiceDom]].length-1)){
                                                        evol = Math.round(((tabDom[tabFixeDom[indiceDom]][indice]["data"] - tabDom[tabFixeDom[indiceDom]][indice-2]["data"]) / tabDom[tabFixeDom[indiceDom]][indice-2]["data"]) *100);
                                                        part = Math.round(((tabDom[tabFixeDom[indiceDom]][indice]["data"] - tabDom[tabFixeDom[indiceDom]][indice-2]["data"]) / tabDom["TOTAL"][indice-2]["data"]) *100);
                                                }else{
                                                        evol = Math.round(((tabDom[tabFixeDom[indiceDom]][indice]["data"] - tabDom[tabFixeDom[indiceDom]][indice-1]["data"]) / tabDom[tabFixeDom[indiceDom]][indice-1]["data"]) *100);
                                                        part = Math.round(((tabDom[tabFixeDom[indiceDom]][indice]["data"] - tabDom[tabFixeDom[indiceDom]][indice-1]["data"]) / tabDom["TOTAL"][indice-1]["data"]) *100);
                                                }

                                                strEvol = "";
                                                if(isNaN(evol)){
                                                        strEvol = "<TD style=\"background-color:#C6C6C6\">0%</TD>";
                                                }else{
                                                        if(evol == "Infinity"){
                                                                strEvol = "<TD style=\"background-color:#ffcc99\">999%</TD>";
                                                        }else{
                                                                if(evol > 0){
                                                                        strEvol = "<TD style=\"background-color:#ffcc99\">"+evol+"%</TD>";
                                                                }else{
                                                                        if(evol == 0){
                                                                                strEvol = "<TD style=\"background-color:#C6C6C6\">"+evol+"%</TD>";
                                                                        }else{
                                                                                strEvol = "<TD style=\"background-color:#83E759\">"+evol+"%</TD>";
                                                                        }
                                                                }
                                                        }
                                                }

                                                if(jQuery.inArray(tabDom[tabFixeDom[indiceDom]][indice]["mois"],mois_exclu)==-1)
                                                {
                                                        strRetour += strEvol;
                                                }

                                                strPart = "";
                                                if(isNaN(part)){
                                                        strPart = "<TD style=\"background-color:#C6C6C6\">0%</TD>";
                                                }else{
                                                        if(part == "Infinity"){
                                                                strPart = "<TD style=\"background-color:#ffcc99\">999%</TD>";
                                                        }else{
                                                                if(part > 0){
                                                                        strPart = "<TD style=\"background-color:#ffcc99\">"+part+"%</TD>";
                                                                }else{
                                                                        if(part == 0){
                                                                                strPart = "<TD style=\"background-color:#C6C6C6\">"+part+"%</TD>";
                                                                        }else{
                                                                                strPart = "<TD style=\"background-color:#83E759\">"+part+"%</TD>";
                                                                        }
                                                                }
                                                        }
                                                }

                                                if(jQuery.inArray(tabDom[tabFixeDom[indiceDom]][indice]["mois"],mois_exclu)==-1)
                                                {
                                                        strRetour += strPart;
                                                }
                                        }
                                        catch (er) {
                                                strRetour += "<TD>N/A</TD>";
                                                strRetour += "<TD>N/A</TD>";
                                        }
                                }
                        }
					
                strRetour += "</TR>";
                }

                strRetour += "</table>";

                div_domEvol.innerHTML = strRetour;
            }
            catch (er) {
                log(0, "ERROR(calcGeneral):" + er.message);
            }
        }
		
    </script>
	
  </head>
  <body>
    
	<!-- page -->
	<div data-role="page" data-title="Titre">
	
		<!-- /panel -->
		<div data-role="panel" id="mypanel" data-display="overlay" data-position="left">

		</div>
		<!-- /panel -->
	
		<!-- header -->
		<div data-role="header" data-position="fixed">
			<a href="#mypanel" data-role="button" data-icon="home" data-iconpos="notext">home</a>
			<h1 id="id_titre">titre</h1>
			<a href="javascript:window.location = ('./page_contact.html?mili='+getMilise());" data-role="button" data-icon="info" data-iconpos="notext">Contact</a>
		</div>
		<!-- /header -->

		<!-- content -->
		<div data-role="content" id="main_content">
			
			<div data-role="collapsible" data-collapsed="false" data-mini="true">
				<h3>Macro-Domaine "Autres"</h3>
				<div id="div_tabAutres1">Erreur macro autres</div>
			</div>
			
			<div data-role="collapsible" data-collapsed="false" data-mini="true">
				<h3>Macro-Domaine "Offre"</h3>
				<div id="div_tabOffres1">Erreur macro offre</div>
			</div>
			
			<div data-role="collapsible" data-collapsed="false" data-mini="true">
				<h3>Macro-Domaine "Appel"</h3>
				<div id="div_tabAppel1">Erreur macro appel</div>
			</div>
			
			<div data-role="collapsible" data-collapsed="false" data-mini="true">
				<h3>Macro-Domaine "Facture"</h3>
				<div id="div_tabFacture1">Erreur macro facture</div>
			</div>
			
			<div data-role="collapsible" data-collapsed="false" data-mini="true">
				<h3>Impact sur les entrants</h3>
				<center>
				<div id="div_domEvol">Erreur impact</div>
				</center>
			</div>
			
		</div>
		<!-- /content -->
		
		<!-- footer -->
		<div data-role="footer" data-position="fixed">
			<a data-role="button" data-icon="search" data-iconpos="notext" class="ui-btn-left" href="javascript:window.location = ('./page_faq.html?mili='+getMilise());">FAQ</a>
			<h1 id="id_affichageUser">User</h1>
			<a data-role="button" data-icon="delete" data-iconpos="notext" class="ui-btn-right" href="javascript:window.location = ('./page_sortie.html?mili='+getMilise());">Logout</a>
		</div>
		<!-- /footer -->
		
	</div>
	<!-- /page -->
</body>
</html>	
